<?php

include 'config.php';
$host = $config[jh_sql][host];
$user = $config[jh_sql][user];
$pwd  = $config[jh_sql][pwd];
$name = $config[jh_sql][name];
$conn = mysqli_connect($host, $user, $pwd, $name);
    if (mysqli_errno($conn)) {
        if($config[jh_error][display] == "开启"){
            mysqli_error($conn);
        }
        exit;
    }

    mysqli_set_charset($conn, $config[jh_sql][charset]);



//删除行数据，可以多行删除
function delete($table_name, $id ,$conn){
    $sql = "delete from ($table_name) where id in($id)";

    $result = mysqli_query($conn, $sql);

    if ($result) {
        echo '删除成功';
    } else {
        echo '删除失败';
    }
}
//插入数据
function insert($table_name, $content, $zhi, $conn){
    $sql = "insert into ($table_name) ('$content') values ('$zhi')";
    $result = mysqli_query($conn, $sql);
    if ($result) {
        echo '成功';
    } else {
        echo '失败';
    }
}




